#支付宝支付配制
#导入支付基类
from .pay import AliPay

#初始化阿里支付对象
def get_ali_object():
    # 沙箱环境地址：https://openhome.alipay.com/platform/appDaily.htm?tab=info
    app_id = "9021000157660576"  #  APPID （沙箱应用）

    # 支付完成后，支付偷偷向这里地址发送一个post请求，识别公网IP,如果是 192.168.20.13局域网IP ,支付宝找不到，def page2() 接收不到这个请求
    notify_url = "http://localhost:8000/user/callback"

    # 支付完成后，跳转的地址。
    return_url = "http://localhost:8000/user/callback"

    merchant_private_key_path = "MIIEpAIBAAKCAQEAz6oH3AgDnVHK46p13jV/0bId0cxbQ2kwpPYH7gbzqyOzs9+3aC2lxnnIeamw5Uj+m4p4hRKRuz0dTYIAFDXzVODWP3X2QdIH8zSXxkv0FRJByIRKFi++9kOgJUbv7vwBzqWp4flGOOyvZpUTdvDqqD7fLbMIQfynERJXXRVtItA4M2/V04ROVvVsqsu4aIhUzM2nFH1wY5jvaXKb0Do7ZOJErJHtZu4qLsi8KaMndxFOlNgmEjng2hiNGgmlFOTWctiHA2y+YNOSoXDRdnHnlG+VIJes3PtudUPMxmrgzHAnQq3olZhFXK5TFdD2Cg7z/424+xHWiqO637kNo5doUQIDAQABAoIBAQClYoLz56YJSrTM8FsC55Suiq5ZAenFHCdTmWXjWcICEGLz5D4LSB94nFDfJBfv41xyv6sQQCOz/Q4zRk+NyRHMDWxUCjxfW0hdlwsxMBhqF6owabsfRFNPibgnOAGqUSWXUDSl9YLJnyZqClwAJAqeh8Pyf10aQH9Fh1fwmDncuIxZjLJMrlAPwoXA6I+ImUak5adIKYwJ2fvzJ61Zv03DL9q+a8zq5qH8rEDjg6aTqGO1YcGVO3kbx7xAf/TxzUoZkp9CjnUAcAkDiYYGhGbPjjrrXFR3iPht8HAP3EFqa/8HlVmLhrKlEO2/LpvIimqoJ/OpQCBHRFefqNVbRHiBAoGBAOqdRW6hSV95uHiaiJqOskUbVxxPmDs0JOD2T3UCzdvdWfxjUo75K8L6Y2BbcI8CzHYT97j1p922tMWUpW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u97W1dzwnLljCtYn/fgU3hEyZ5u+4MGeP19d9LAS2jZB6kUjn8InN3kNiwcihGPOEEb8vB3Iw11+1lwvFVOE2Pfxo2EM/A/7+FLWUUUHTTMwEbRBI6TvgsXeCLtx4Nl1EgthXAGelQIDAQAB"  # 支付宝公钥
    alipay = AliPay(
        appid=app_id,
        app_notify_url=notify_url,
        return_url=return_url,
        app_private_key_path=merchant_private_key_path,
        alipay_public_key_path=alipay_public_key_path,  # 支付宝的公钥，验证支付宝回传消息使用，不是你自己的公钥
        debug=True,  # 默认False,
    )
    return alipay